module CheckRoll;
import std.conv;
import Dice;

class CheckRoll {
	protected ubyte ub_value;
	@property value() {
		return ub_value;
	}
	this(ubyte x) {
		if(x > 6)
			throw new Exception("Out of bounds"); //Really need custom exceptions...
		ub_value = x;
	}
	override string toString() {
		if(ub_value > 0)
			return to!(string)(ub_value) ~ "+";
	       	return "-";
	}
	public bool check() {
		if(ub_value == 0)
			throw new Exception("Cannot check against 0");
		Dice d6 = new Dice();
		return check(d6.roll());
	}
	public bool check(Dice d6) {
		return check(d6.result);
	}
	public bool check(ubyte x) {
		if(ub_value == 0)
			throw new Exception ("Cannot check against 0");
		if(x == 1)
			return false;
		if(x >= ub_value)
			return true;
		return false;
	}
}

